package com.warrant.module.rpa.finance.util;

import com.greenpineyu.fel.FelEngine;
import com.greenpineyu.fel.FelEngineImpl;
import com.greenpineyu.fel.context.FelContext;

public class FastelUtil {

	private static FelEngine engine;

	private FastelUtil() {
	}

	private static FelEngine getFelEngine() {
		if (engine == null) {
			synchronized (JexlUtil.class) {
				if (engine == null) {
					engine = new FelEngineImpl();
				}
			}
		}
		return engine;
	}

	public static Object execute(String expression, FelContext context) {
		FelEngine felEngine = getFelEngine();
		return felEngine.eval(expression, context);
	}

}
